﻿using System;
using System.Collections.Generic;
using System.Text;
using SdmxMl.Structure;
using SdmxMl.Common;
using SdmxMl.Manager;

namespace ActivityMgr.HGDE
{
    public enum TimePosition
    {
        Outside,
        Inside,
        StopInside,
        StartInside,
        Constant
    }

    public class TimedCodeType
    {
        public string clRef;
        public CodeType Code;
        public CodeType ParentCode;
        public DateTime dtFrom;
        public DateTime dtTo;
        public TimePosition TimePos;
        public string Inscription;
        public string Radiation;
        public bool Treated;
        public string NonHistCode;


        public TimedCodeType(string r, DateTime f, DateTime t, CodeType c, CodeType parent, TimePosition tp)
        {
            clRef = r;
            dtFrom = f;
            dtTo = t;
            Code = c;
            NonHistCode = c.AnnotationList.GetTextOfAnnotationType("CODE_OFS");
            if (NonHistCode.Length == 0)
                NonHistCode = Code.Id; // same as Hist if missing
            ParentCode = parent;
            TimePos = tp;

            // Inscription, Radistion
            Inscription = Radiation = string.Empty;
            if (tp != TimePosition.Constant && tp != TimePosition.Outside)
            {
                Inscription = c.AnnotationList.GetTextOfAnnotationType("INSCRIPTION");
                Radiation = c.AnnotationList.GetTextOfAnnotationType("RADIATION");
            }

        }
    }
}
